<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/11/28 0028
  Time: 16:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="jquery/jquery-3.0.0.min.js"></script>
    <script>
        $(function () {
            $(":button").click(function () {
                // alert("ok")
                var name = $(":text[name='username']").val();
                var pwd = $(":text[name='pwd']").val();
                // var user ={
                //     name:name,
                //     pwd:pwd
                // }
                // console.log(name+pwd)
                var user=$("form").serialize();

                $.ajax({
                    type:"get",
                    url:"${pageContext.request.contextPath}/lservlet",
                    // data:"name="+name+"&pwd="+pwd,
                    data:user,
                    success:function (msg) {
                        console.log(msg);
                    }
                })
            })
        })
    </script>
</head>
<body>
<form action="">
    用户名 <input type="text" name="name"> <br>
    密码 <input type="text" name="pwd"> <br>
    <input type="button" value="测试">
</form>
</body>
</html>
